#include "CSharpInterface.h"
#include "../HighLevel/SoundSystem.h"

__nogc class SoundSystem* gSystem = NULL;

void CSharpInterface::Create(void* hwnd)
{
	gSystem = SoundSystem::Inst();
	gSystem->Initialize((HWND)hwnd,true);

	gSystem->PlayFile(L"LongSound.wav",true);
}

void CSharpInterface::Release()
{
	gSystem->Destroy();
	gSystem = 0;
}

void CSharpInterface::Update(float delta)
{
	gSystem->Update(delta);
}




bool CSharpInterface::LoadSoundXML(const char* file, bool updateCoreSystem)
{
	return gSystem->GetToolSystem()->LoadSoundXML(file,updateCoreSystem);
}

bool CSharpInterface::SaveSoundXML(const char* file)
{
	return gSystem->GetToolSystem()->SaveSoundXML(file);
}

void CSharpInterface::UpdateCoreSystem()
{
	return gSystem->GetToolSystem()->UpdateCoreSystem();
}

CategoryHandle CSharpInterface::NewCategory(const char* categoryName)
{
	return gSystem->GetToolSystem()->NewCategory(categoryName);
}

unsigned CSharpInterface::GetCategoryCount()
{
	return gSystem->GetToolSystem()->GetCategoryCount();
}

const char* CSharpInterface::GetCategoryName(unsigned index)
{
	return gSystem->GetToolSystem()->GetCategoryName(index);
}

bool CSharpInterface::SetCategoryName(unsigned index, const char* name)
{
	return gSystem->GetToolSystem()->SetCategoryName(index,name);
}

bool CSharpInterface::RemoveCategory(unsigned index)
{
	return gSystem->GetToolSystem()->RemoveCategory(index);
}

bool CSharpInterface::NewSoundFile(const CategoryHandle& catID, const char* name, const char* file)
{
	return gSystem->GetToolSystem()->NewSoundFile(catID,name,file);
}

unsigned CSharpInterface::GetSoundFileCount(const CategoryHandle& categoryID)
{
	return gSystem->GetToolSystem()->GetSoundFileCount(categoryID);
}

const char* CSharpInterface::GetSoundFilename(const CategoryHandle& categoryID, unsigned index)
{
	return gSystem->GetToolSystem()->GetSoundFilename(categoryID,index);
}

const char*	CSharpInterface::GetSoundName(const CategoryHandle& categoryID, unsigned index)
{
	return gSystem->GetToolSystem()->GetSoundName(categoryID,index);
}

bool CSharpInterface::SetSoundFilename(const CategoryHandle& categoryID, unsigned index, const char* filename)
{
	return gSystem->GetToolSystem()->SetSoundFilename(categoryID,index,filename);
}

bool CSharpInterface::SetSoundName(const CategoryHandle& categoryID, unsigned index, const char* name)
{
	return gSystem->GetToolSystem()->SetSoundName(categoryID,index,name);
}

bool CSharpInterface::RemoveSound(const CategoryHandle& categoryID, unsigned index)
{
	return gSystem->GetToolSystem()->RemoveSound(categoryID,index);
}

bool CSharpInterface::SetSoundPath(const CategoryHandle& catID, const char* path)
{
	return gSystem->GetToolSystem()->SetSoundPath(catID,path);
}

const char* CSharpInterface::GetSoundPath(const CategoryHandle& categoryID)
{
	return gSystem->GetToolSystem()->GetSoundPath(categoryID);
}

bool CSharpInterface::NewVariable(const char* varName, float min, float max)
{
	return gSystem->GetToolSystem()->NewVariable(varName,min,max);
}

unsigned CSharpInterface::GetVariableCount()
{
	return gSystem->GetToolSystem()->GetVariableCount();
}

const char* CSharpInterface::GetVariableName(unsigned index)
{
	return gSystem->GetToolSystem()->GetVariableName(index);
}

float CSharpInterface::GetVariableMin(unsigned index)
{
	return gSystem->GetToolSystem()->GetVariableMin(index);
}

float CSharpInterface::GetVariableMax(unsigned index)
{
	return gSystem->GetToolSystem()->GetVariableMax(index);
}

bool CSharpInterface::SetVariableName(unsigned index, const char* name)
{
	return gSystem->GetToolSystem()->SetVariableName(index,name);
}

bool CSharpInterface::SetVariableMin(unsigned index, float min)
{
	return gSystem->GetToolSystem()->SetVariableMin(index,min);
}

bool CSharpInterface::SetVariableMax(unsigned index, float max)
{
	return gSystem->GetToolSystem()->SetVariableMax(index,max);
}

bool CSharpInterface::RemoveVariable(unsigned index)
{
	return gSystem->GetToolSystem()->RemoveVariable(index);
}

GraphHandle CSharpInterface::NewGraph(const char* graphName)
{
	return gSystem->GetToolSystem()->NewGraph(graphName);
}

bool CSharpInterface::ClearGraph(const GraphHandle& graphID)
{
	return gSystem->GetToolSystem()->ClearGraph(graphID);
}

bool CSharpInterface::RemoveGraph(const GraphHandle& graphID)
{
	return gSystem->GetToolSystem()->RemoveGraph(graphID);
}

const char* CSharpInterface::GetGraphName(const GraphHandle& graphID)
{
	return gSystem->GetToolSystem()->GetGraphName(graphID);
}

bool CSharpInterface::SetGraphName(const GraphHandle& graphID, const char* name)
{
	return gSystem->GetToolSystem()->SetGraphName(graphID,name);
}

bool CSharpInterface::AddPoint(const GraphHandle& graphID, float x, float y)
{
	return gSystem->GetToolSystem()->AddPoint(graphID,x,y);
}

EventHandle CSharpInterface::NewEvent(const char* name)
{
	return gSystem->GetToolSystem()->NewEvent(name);
}

bool CSharpInterface::RemoveEvent(const EventHandle& eventID)
{
	return gSystem->GetToolSystem()->RemoveEvent(eventID);
}

SubEventHandle CSharpInterface::AddSubEvent(const EventHandle& eventID, const char* soundName, float triggerTime)
{
	return gSystem->GetToolSystem()->AddSubEvent(eventID,soundName,triggerTime);
}

bool CSharpInterface::RemoveSubEvent(const EventHandle& eventID, const SubEventHandle& subID)
{
	return gSystem->GetToolSystem()->RemoveSubEvent(eventID,subID);
}

EffectHandle CSharpInterface::AddSoundEffect(const EventHandle& eventID, const SubEventHandle& subID, const char* graphName, const char* varName, unsigned effect)
{
	return gSystem->GetToolSystem()->AddSoundEffect(eventID,subID,graphName,varName,effect);
}

EffectHandle CSharpInterface::AddSoundEffect(const EventHandle& eventID, const SubEventHandle& subID, GraphHandle graphID, VariableHandle varID, unsigned effect)
{
	return gSystem->GetToolSystem()->AddSoundEffect(eventID,subID,graphID,varID,effect);
}

bool CSharpInterface::RemoveSoundEffect(const EventHandle& eventID, const SubEventHandle& subID, const EffectHandle& fxID)
{
	return gSystem->GetToolSystem()->RemoveSoundEffect(eventID,subID,fxID);
}
